package com.accenture.adf.newcodington.module16.sample.basic;

import org.junit.Test;

import com.accenture.adf.newcodington.module16.sample.advanced.MyCalculatorTryIt;

import junit.framework.TestCase;

/**
 * Testcase for demonstrate unit tests for MyCalculatorTryIt
 */
public class TestMyCalculatorTryIt extends TestCase {

	MyCalculatorTryIt calculator;

	protected void setUp() throws Exception {
		super.setUp();
		calculator = new MyCalculatorTryIt();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	@Test
	/**
	 * Positive testcase for addNumbers method
	 */
	public void testAddNumbers_Positive() {
		int num1 = 23;
		int num2 = 34;
		try {
			assertEquals(57, calculator.addNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			fail("No exception should be thrown");
		}
	}

	@Test
	/**
	 * Positive testcase for subtractNumbers method
	 */
	public void testSubtractNumbers_Positive() {
		int num1 = 23;
		int num2 = 12;
		try {
			assertEquals(11, calculator.subtractNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			fail("No exception should be thrown");
		}
	}

	@Test
	/**
	 * Positive testcase for MultiplyNumbers method
	 */
	public void testMultiplyNumbers_Positive() {
		int num1 = 3;
		int num2 = 2;
		try {
			assertEquals(6.0, calculator.multiplyNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			fail("No exception should be thrown");
		}
	}

	@Test
	/**
	 * Positive testcase for DivideNumbers method
	 */
	public void testDivideNumbers_Positive() {
		int num1 = 30;
		int num2 = 2;
		try {
			assertEquals(15.0, calculator.divideNumbers(num1, num2));
		} catch (ArithmeticException ex) {
			fail("No exception should be thrown");
		}
	}

}
